package com.alibaba.dongbao.base.Code;

import com.alibaba.dongbao.base.result.Result;

/**
 * @Author: Mr.ZJW
 * @Date: 2022-04-07 15:59
 * @Description: 统一返回值编码
 */
public class CodeMsg {

    private int code;
    private String msg;

    // 按照模块定义CodeMsg
    // 通用异常
    public static final CodeMsg SUCCESS = new CodeMsg(200,"success");
    public static final CodeMsg ERROR = new CodeMsg(-1,"error");
    public static final CodeMsg SERVER_EXCEPTION = new CodeMsg(500100,"服务端异常");
    public static final CodeMsg PARAMETER_ISNULL = new CodeMsg(500101,"输入参数为空");
    // 业务异常
    public static final CodeMsg USER_NOT_EXSIST = new CodeMsg(500102,"用户不存在");
    public static final CodeMsg ONLINE_USER_OVER = new CodeMsg(500103,"在线用户数超出允许登录的最大用户限制。");
    public static final CodeMsg SESSION_NOT_EXSIST =  new CodeMsg(500104,"不存在离线token数据");
    public static final CodeMsg NOT_FIND_DATA = new CodeMsg(500105,"查找不到对应数据");

    public static final CodeMsg LOGIN_SUCCESS=new CodeMsg(Result.OK,"登陆成功");
    public static final CodeMsg LOGIN_ERROR_PASS=new CodeMsg(Result.ERROR,"用户名或密码错误");

    public static final CodeMsg LOGIN_SUCCESS_CODE=new CodeMsg(Result.OK,"验证码正确");
    public static final CodeMsg LOGIN_ERROR_CODE=new CodeMsg(Result.ERROR,"验证码不存在或错误，请重式!");

    public static final CodeMsg TOKEN_EXPIRED=new CodeMsg(Result.ERROR,"Token会话过期或者异常，请重新登录");

    public static final CodeMsg ADD_SUCCESS = new CodeMsg(Result.OK, "添加成功");
    public static final CodeMsg ADD_ERROR = new CodeMsg(Result.ERROR, "添加失败");

    public static final CodeMsg DELETE_SUCCESS = new CodeMsg(Result.OK, "删除成功");
    public static final CodeMsg DELETE_ERROR = new CodeMsg(Result.ERROR, "删除失败");

    public static final CodeMsg UPDATE_SUCCESS = new CodeMsg(Result.OK, "修改成功");
    public static final CodeMsg UPDATE_ERROR = new CodeMsg(Result.ERROR, "修改失败");

    public static final CodeMsg REGISTER_SUCCESS = new CodeMsg(Result.OK, "注册成功");
    public static final CodeMsg REGISTER_ERROR = new CodeMsg(Result.ERROR, "注册失败");

    public static final CodeMsg PASSWORD_INCLUDE_ENGLISH_NUMBER_SYMBOL = new CodeMsg(Result.ERROR, "修改失败，新密码必须包含英文+数字+特殊符号组成");
    public static final CodeMsg OLD_PASSWORD_LIKE_NEW_PASSWORD = new CodeMsg(Result.ERROR, "原始密码和新密码一致，请重新输入");
    public static final CodeMsg NEW_PASSWORD_UNLIKE = new CodeMsg(Result.ERROR, "新密码不一致，请重新输入");
    public static final CodeMsg ORIGINAL_PASSWORD_ERROR = new CodeMsg(Result.ERROR, "原始始密码错误，请重新输入");




    private CodeMsg(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
